home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Ultimate Window Set -…Games & Quality Programs
/
The Ultimate Window Set - 250 Games & Quality Programs.iso
/
win
/
pro125
/
napoleon.cdl
< prev
next >
Wrap
Text File
|
1993-09-22
|
7KB
|
337 lines
//⌐ David Jean, 1993
game napoleon is 41 by 24;
// A1 A2 A3 A4 A5 A6 A7 A8
// B1 B2 B3 B4 B5 B6 B7 B8 B9 B0
//
// D1 D2
{--------------------------------------------------------------------------}
{****c1 et c2 sont de meme sorte}
predicate SameSuite?(c1, c2 : Card) is
return (c1 / 13) = (c2 / 13);
{****c2 est un de plus que c1}
predicate FollowSuite?(c1, c2 : Card) is
return (c1 + 1) = c2;
{****c1 et c2 sont du meme Rang}
predicate SameRank?(c1, c2 : Card) is
return (c1 mod 13) = (c2 mod 13);
{****c1 et c2 ont la meme face}
predicate SameCard?(c1, c2 : Card) is
return (c1 mod DeckSize) = (c2 mod DeckSize);
{--------------------------------------------------------------------------}
procedure About is
begin
Clear 'About NapolΘon α Sainte-HΘlΦne';
write('Rules from : RΘglements officiels des jeux de cartes, Intl. playing card company limited, 1977.\n');
write('Program : ⌐ David Jean, 1993.\n');
end;
procedure RButton is
begin
Clear 'Right Mouse Button';
Write('If you click here with the right button, the card will automatically ');
Write('go to the most appropriate place, looking for a spot in The Foundation first ');
Write('and then to the Tableau.\n');
Write('If the card can\'t be played nothing will happen.\n');
Wait 'About...' About;
end;
stack D2;
stack A1;
stack A2;
stack A3;
stack A4;
stack A5;
stack A6;
stack A7;
stack A8;
stack B1;
stack B2;
stack B3;
stack B4;
stack B5;
stack B6;
stack B7;
stack B8;
stack B9;
stack B0;
stack D1 is
X := 2;
Y := 20;
Direction := over;
W := 3;
H := 4;
//****************************
Start is
begin
Add Ace+Spade .. King+Diamond;
Add Ace+Spade .. King+Diamond;
Turn [1..104] side down;
Shuffle;
[0]:=CrossCard;
end;
//****************************
SelectLeftFrom(Spos : Index) is
begin
if !<>0 then
begin
Turn [!] Side Up;
Pull 1 To D2;
end;
end;
//****************************
Help is
begin
Clear 'The Stock';
Write('You can click here to move a card to The Waste Pile.\n');
Wait 'About...' About;
end;
end D1;
stack D2 is
X := 7;
Y := 20;
Direction := right;
W := 34;
H := 4;
//****************************
SelectLeftFrom(Spos : Index) is
if !<>0 then
Pull 1 To Cursor;
//****************************
SelectRightFrom(Spos : Index) is
begin
with ST do
if !<>0 then
if ((ST!=0) and SameCard?([!],ST[0])) or
(SameSuite?(ST[ST!],[!]) and FollowSuite?(ST[ST!],[!])) then
begin
Pull 1 To ST;
break procedure;
end
for A1, A2, A3, A4, A5, A6, A7, A8;
with ST do
if !<>0 then
if (ST!>0) and
(SameSuite?(ST[ST!],[!]) and
FollowSuite?([!],ST[ST!])) then
begin
Pull 1 To ST;
break procedure;
end
for B1, B2, B3, B4, B5, B6, B7, B8, B9, B0;
with ST do
if !<>0 then
if (ST!=0) then
begin
Pull 1 To ST;
break procedure;
end
for B1, B2, B3, B4, B5, B6, B7, B8, B9, B0;
end;
//****************************
Help is
begin
Clear 'The Waste Pile';
Write('The topmost card of this pile is available to play on The Tableau or The Foundation.\n\n');
Write('You can Drag cards from here by using the left mouse button.\n\n');
Wait 'Right Button...' RButton;
Wait 'About...' About;
end;
end D2;
{--------------------------------------------------------------------------}
stack A1 is
X := 6;
Y := 2;
Direction := over;
W := 3;
H := 4;
//****************************
Start is
begin
[0]:=Ace+Spade;
Turn [0] Side Shaded;
end;
//****************************
SelectLeftTo(Spos : Index) is
begin
if Cursor!=1 then
if (!=0) and SameCard?([0],Cursor[1]) then
Pull 1 From Cursor
else if SameSuite?(Cursor[1],[!]) and
FollowSuite?([!],Cursor[1]) then
Pull 1 From Cursor;
end;
//****************************
Help is
begin
Clear 'Foundations';
Write('Plays are made to the Foundations in the same suit and in ascending order.\n\n');
Write('The goal is to move all 104 cards here.\n\n');
Write('At the start, this stack is grayed to indicate which card must be played here first.\n');
Wait 'About...' About;
end;
end A1;
stack A2 from A1 is
X := 10;
Y := 2;
//****************************
Start is
begin
[0]:=Ace+Heart;
Turn [0] Side Shaded;
end;
end A2;
stack A3 from A1 is
X := 14;
Y := 2;
//****************************
Start is
begin
[0]:=Ace+Club;
Turn [0] Side Shaded;
end;
end A3;
stack A4 from A1 is
X := 18;
Y := 2;
//****************************
Start is
begin
[0]:=Ace+Diamond;
Turn [0] Side Shaded;
end;
end A4;
stack A5 from A1 is
X := 22;
Y := 2;
end A5;
stack A6 from A2 is
X := 26;
Y := 2;
end A6;
stack A7 from A3 is
X := 30;
Y := 2;
end A7;
stack A8 from A4 is
X := 34;
Y := 2;
end A8;
{--------------------------------------------------------------------------}
stack B1 is
X := 2;
Y := 7;
Direction := down;
W := 3;
H := 12;
//****************************
Start is
begin
Pull 4 From D1;
Turn [1..4] Side Up;
Draw D1;
end;
//****************************
SelectLeftFrom(Spos : Index) is
begin
if !>0 then Pull 1 To Cursor;
end;
//****************************
SelectLeftTo(Spos : Index) is
begin
if (!=0) then
Pull 1 From Cursor
else if SameSuite?(Cursor[1],[!]) and
FollowSuite?(Cursor[1],[!]) then
Pull 1 From Cursor;
end;
//****************************
SelectRightFrom from D2;
//****************************
Help is
begin
Clear 'The Tableau';
Write('Each card played here must be in descending sequence and of the same suit ');
Write('to the card on which it is played.\n\n');
Write('The bottommost card is available to play to The Foundation or to The Tableau.\n');
Write('You can Drag cards from here by using the left mouse button.\n\n');
Write('Any card can be moved in an empty spot.\n');
Wait 'Right Button...' RButton;
Wait 'About...' About;
end;
end B1;
stack B2 from B1 is
X := 6;
Y := 7;
end B2;
stack B3 from B1 is
X := 10;
Y := 7;
end B3;
stack B4 from B1 is
X := 14;
Y := 7;
end B4;
stack B5 from B1 is
X := 18;
Y := 7;
end B5;
stack B6 from B1 is
X := 22;
Y := 7;
end B6;
stack B7 from B1 is
X := 26;
Y := 7;
end B7;
stack B8 from B1 is
X := 30;
Y := 7;
end B8;
stack B9 from B1 is
X := 34;
Y := 7;
end B9;
stack B0 from B1 is
X := 38;
Y := 7;
end B0;
{--------------------------------------------------------------------------}
predicate Win? is
return (A1!=13) and (A2!=13) and (A3!=13) and (A4!=13) and
(A5!=13) and (A6!=13) and (A7!=13) and (A8!=13);
order D1, D2, A1, A2, A3, A4, A5, A6, A7, A8,
B1, B2 ,B3, B4, B5, B6, B7, B8, B9, B0.